﻿; Using Keyboard Numpad as a Mouse -- by deguix
; https://www.autohotkey.com
; This script makes mousing with your keyboard almost as easy
; as using a real mouse (maybe even easier 遍历 some tasks).
; It supports up to five mouse buttons and the turning of the
; mouse wheel.  It also features customizable movement speed,
; acceleration, and "axis inversion".

/*
o------------------------------------------------------------o
|Using Keyboard Numpad as a Mouse                            |
(------------------------------------------------------------)
| By deguix           / A Script file 遍历 AutoHotkey         |
|                    ----------------------------------------|
|                                                            |
|    This script is an example of use of AutoHotkey. It uses |
| the remapping of numpad keys of a keyboard to transform it |
| into a mouse. Some features are the acceleration which     |
| enables you to increase the mouse movement when holding    |
| a key 遍历 a long time, and the rotation which makes the    |
| numpad mouse to "turn". I.e. NumpadDown as NumpadUp        |
| and vice-versa. See the list of keys used below:           |
|                                                            |
|------------------------------------------------------------|
| Keys                  | Description                        |
|------------------------------------------------------------|
| ScrollLock (toggle on)| Activates numpad mouse mode.       |
|-----------------------|------------------------------------|
| Numpad0               | Left mouse button 点击.           |
| Numpad5               | Middle mouse button 点击.         |
| NumpadDot             | Right mouse button 点击.          |
| NumpadDiv/NumpadMult  | X1/X2 mouse button 点击.          |
| NumpadSub/NumpadAdd   | Moves up/down the mouse wheel.     |
|                       |                                    |
|-----------------------|------------------------------------|
| NumLock (toggled off) | Activates mouse movement mode.     |
|-----------------------|------------------------------------|
| NumpadEnd/Down/PgDn/  | Mouse movement.                    |
| /Left/Right/Home/Up/  |                                    |
| /PgUp                 |                                    |
|                       |                                    |
|-----------------------|------------------------------------|
| NumLock (toggled on)  | Activates mouse speed adj. mode.   |
|-----------------------|------------------------------------|
| Numpad7/Numpad1       | Inc./dec. acceleration per         |
|                       | button press.                      |
| Numpad8/Numpad2       | Inc./dec. initial speed per        |
|                       | button press.                      |
| Numpad9/Numpad3       | Inc./dec. maximum speed per        |
|                       | button press.                      |
| !Numpad7/!Numpad1     | Inc./dec. wheel acceleration per   |
|                       | button press*.                     |
| !Numpad8/!Numpad2     | Inc./dec. wheel initial speed per  |
|                       | button press*.                     |
| !Numpad9/!Numpad3     | Inc./dec. wheel maximum speed per  |
|                       | button press*.                     |
| Numpad4/Numpad6       | Inc./dec. rotation angle to        |
|                       | right in degrees. (i.e. 180°=      |
|                       | = inversed controls).              |
|------------------------------------------------------------|
| * = These options are affected by the mouse wheel speed    |
| adjusted on Control Panel. If you don't have a mouse with  |
| wheel, the default is 3 +/- lines per option button press. |
o------------------------------------------------------------o
*/

;START OF CONFIG SECTION

#单例模式
#最大热键频率 500

; Using the keyboard hook to implement the Numpad hotkeys prevents
; them from interfering with the generation of ANSI characters such
; as à.  This is because AutoHotkey generates such characters
; by holding down ALT and sending a series of Numpad keystrokes.
; Hook hotkeys are smart enough to ignore such keystrokes.
#强制使用钩

MouseSpeed := 1
MouseAccelerationSpeed := 1
MouseMaxSpeed := 5

;Mouse wheel speed is also set on Control Panel. As that
;will affect the normal mouse behavior, the real speed of
;these three below are times the normal mouse wheel speed.
MouseWheelSpeed := 1
MouseWheelAccelerationSpeed := 1
MouseWheelMaxSpeed := 5

MouseRotationAngle := 0

;END OF CONFIG SECTION

;This is needed or key presses would faulty 发送 their natural
;actions. Like NumpadDiv would 发送 sometimes "/" to the
;screen.
#安装键盘钩

Temp := 0
Temp2 := 0

MouseRotationAnglePart := MouseRotationAngle
;Divide by 45° because 鼠标移动 only supports whole numbers,
;and changing the mouse rotation to a number lesser than 45°
;could make strange movements.
;
;遍历 example: 22.5° when pressing NumpadUp:
;  First it would move upwards 直到 the speed
;  to the side reaches 1.
MouseRotationAnglePart /= 45

MouseCurrentAccelerationSpeed := 0
MouseCurrentSpeed := MouseSpeed

MouseWheelCurrentAccelerationSpeed := 0
MouseWheelCurrentSpeed := MouseSpeed

设置按键延迟 -1
设置鼠标延迟 -1

Hotkey "*Numpad0", "ButtonLeftClick"
Hotkey "*NumpadIns", "ButtonLeftClickIns"
Hotkey "*Numpad5", "ButtonMiddleClick"
Hotkey "*NumpadClear", "ButtonMiddleClickClear"
Hotkey "*NumpadDot", "ButtonRightClick"
Hotkey "*NumpadDel", "ButtonRightClickDel"
Hotkey "*NumpadDiv", "ButtonX1Click"
Hotkey "*NumpadMult", "ButtonX2Click"

Hotkey "*NumpadSub", "ButtonWheelUp"
Hotkey "*NumpadAdd", "ButtonWheelDown"

Hotkey "*NumpadUp", "ButtonUp"
Hotkey "*NumpadDown", "ButtonDown"
Hotkey "*NumpadLeft", "ButtonLeft"
Hotkey "*NumpadRight", "ButtonRight"
Hotkey "*NumpadHome", "ButtonUpLeft"
Hotkey "*NumpadEnd", "ButtonUpRight"
Hotkey "*NumpadPgUp", "ButtonDownLeft"
Hotkey "*NumpadPgDn", "ButtonDownRight"

Hotkey "Numpad8", "ButtonSpeedUp"
Hotkey "Numpad2", "ButtonSpeedDown"
Hotkey "Numpad7", "ButtonAccelerationSpeedUp"
Hotkey "Numpad1", "ButtonAccelerationSpeedDown"
Hotkey "Numpad9", "ButtonMaxSpeedUp"
Hotkey "Numpad3", "ButtonMaxSpeedDown"

Hotkey "Numpad6", "ButtonRotationAngleUp"
Hotkey "Numpad4", "ButtonRotationAngleDown"

Hotkey "!Numpad8", "ButtonWheelSpeedUp"
Hotkey "!Numpad2", "ButtonWheelSpeedDown"
Hotkey "!Numpad7", "ButtonWheelAccelerationSpeedUp"
Hotkey "!Numpad1", "ButtonWheelAccelerationSpeedDown"
Hotkey "!Numpad9", "ButtonWheelMaxSpeedUp"
Hotkey "!Numpad3", "ButtonWheelMaxSpeedDown"

Gosub ~ScrollLock  ; Initialize based on current ScrollLock state.
返回

;Key activation support

~ScrollLock::
; Wait 遍历 it to be released because otherwise the hook state gets reset
; while the key is down, which causes the up-event to get suppressed,
; which in turn prevents toggling of the ScrollLock state/light:
KeyWait "ScrollLock"
if GetKeyState("ScrollLock", "T")
{
    Hotkey "*Numpad0", "On"
    Hotkey "*NumpadIns", "On"
    Hotkey "*Numpad5", "On"
    Hotkey "*NumpadDot", "On"
    Hotkey "*NumpadDel", "On"
    Hotkey "*NumpadDiv", "On"
    Hotkey "*NumpadMult", "On"

    Hotkey "*NumpadSub", "On"
    Hotkey "*NumpadAdd", "On"

    Hotkey "*NumpadUp", "On"
    Hotkey "*NumpadDown", "On"
    Hotkey "*NumpadLeft", "On"
    Hotkey "*NumpadRight", "On"
    Hotkey "*NumpadHome", "On"
    Hotkey "*NumpadEnd", "On"
    Hotkey "*NumpadPgUp", "On"
    Hotkey "*NumpadPgDn", "On"

    Hotkey "Numpad8", "On"
    Hotkey "Numpad2", "On"
    Hotkey "Numpad7", "On"
    Hotkey "Numpad1", "On"
    Hotkey "Numpad9", "On"
    Hotkey "Numpad3", "On"

    Hotkey "Numpad6", "On"
    Hotkey "Numpad4", "On"

    Hotkey "!Numpad8", "On"
    Hotkey "!Numpad2", "On"
    Hotkey "!Numpad7", "On"
    Hotkey "!Numpad1", "On"
    Hotkey "!Numpad9", "On"
    Hotkey "!Numpad3", "On"
}
else
{
    Hotkey "*Numpad0", "Off"
    Hotkey "*NumpadIns", "Off"
    Hotkey "*Numpad5", "Off"
    Hotkey "*NumpadDot", "Off"
    Hotkey "*NumpadDel", "Off"
    Hotkey "*NumpadDiv", "Off"
    Hotkey "*NumpadMult", "Off"

    Hotkey "*NumpadSub", "Off"
    Hotkey "*NumpadAdd", "Off"

    Hotkey "*NumpadUp", "Off"
    Hotkey "*NumpadDown", "Off"
    Hotkey "*NumpadLeft", "Off"
    Hotkey "*NumpadRight", "Off"
    Hotkey "*NumpadHome", "Off"
    Hotkey "*NumpadEnd", "Off"
    Hotkey "*NumpadPgUp", "Off"
    Hotkey "*NumpadPgDn", "Off"

    Hotkey "Numpad8", "Off"
    Hotkey "Numpad2", "Off"
    Hotkey "Numpad7", "Off"
    Hotkey "Numpad1", "Off"
    Hotkey "Numpad9", "Off"
    Hotkey "Numpad3", "Off"

    Hotkey "Numpad6", "Off"
    Hotkey "Numpad4", "Off"

    Hotkey "!Numpad8", "Off"
    Hotkey "!Numpad2", "Off"
    Hotkey "!Numpad7", "Off"
    Hotkey "!Numpad1", "Off"
    Hotkey "!Numpad9", "Off"
    Hotkey "!Numpad3", "Off"
}
返回

;Mouse 点击 support

ButtonLeftClick:
if GetKeyState("LButton")
    返回
Button2 := "Numpad0"
ButtonClick := "Left"
跳转 ButtonClickStart
ButtonLeftClickIns:
if GetKeyState("LButton")
    返回
Button2 := "NumpadIns"
ButtonClick := "Left"
跳转 ButtonClickStart

ButtonMiddleClick:
if GetKeyState("MButton")
    返回
Button2 := "Numpad5"
ButtonClick := "Middle"
跳转 ButtonClickStart
ButtonMiddleClickClear:
if GetKeyState("MButton")
    返回
Button2 := "NumpadClear"
ButtonClick := "Middle"
跳转 ButtonClickStart

ButtonRightClick:
if GetKeyState("RButton")
    返回
Button2 := "NumpadDot"
ButtonClick := "Right"
跳转 ButtonClickStart
ButtonRightClickDel:
if GetKeyState("RButton")
    返回
Button2 := "NumpadDel"
ButtonClick := "Right"
跳转 ButtonClickStart

ButtonX1Click:
if GetKeyState("XButton1")
    返回
Button2 := "NumpadDiv"
ButtonClick := "X1"
跳转 ButtonClickStart

ButtonX2Click:
if GetKeyState("XButton2")
    返回
Button2 := "NumpadMult"
ButtonClick := "X2"
跳转 ButtonClickStart

ButtonClickStart:
鼠标点击 ButtonClick,,, 1, 0, "D"
SetTimer "ButtonClickEnd", 10
返回

ButtonClickEnd()
{
    global
    if GetKeyState(Button2, "P")
        返回

    SetTimer, 0
    鼠标点击 ButtonClick,,, 1, 0, "U"
}

;Mouse movement support

ButtonSpeedUp:
MouseSpeed++
工具提示 "Mouse speed: " MouseSpeed " pixels"
SetTimer () => 工具提示(), -1000
返回
ButtonSpeedDown:
if MouseSpeed > 1
    MouseSpeed--
if MouseSpeed = 1
    工具提示 "Mouse speed: " MouseSpeed " pixel"
else
    工具提示 "Mouse speed: " MouseSpeed " pixels"
SetTimer () => 工具提示(), -1000
返回
ButtonAccelerationSpeedUp:
MouseAccelerationSpeed++
工具提示 "Mouse acceleration speed: " MouseAccelerationSpeed " pixels"
SetTimer () => 工具提示(), -1000
返回
ButtonAccelerationSpeedDown:
if MouseAccelerationSpeed > 1
    MouseAccelerationSpeed--
if MouseAccelerationSpeed = 1
    工具提示 "Mouse acceleration speed: " MouseAccelerationSpeed " pixel"
else
    工具提示 "Mouse acceleration speed: " MouseAccelerationSpeed " pixels"
SetTimer () => 工具提示(), -1000
返回

ButtonMaxSpeedUp:
MouseMaxSpeed++
工具提示 "Mouse maximum speed: " MouseMaxSpeed " pixels"
SetTimer () => 工具提示(), -1000
返回
ButtonMaxSpeedDown:
if MouseMaxSpeed > 1
    MouseMaxSpeed--
if MouseMaxSpeed = 1
    工具提示 "Mouse maximum speed: " MouseMaxSpeed " pixel"
else
    工具提示 "Mouse maximum speed: " MouseMaxSpeed " pixels"
SetTimer () => 工具提示(), -1000
返回

ButtonRotationAngleUp:
MouseRotationAnglePart++
if MouseRotationAnglePart >= 8
    MouseRotationAnglePart := 0
MouseRotationAngle := MouseRotationAnglePart
MouseRotationAngle *= 45
工具提示 "Mouse rotation angle: " MouseRotationAngle "°"
SetTimer () => 工具提示(), -1000
返回
ButtonRotationAngleDown:
MouseRotationAnglePart--
if MouseRotationAnglePart < 0
    MouseRotationAnglePart := 7
MouseRotationAngle := MouseRotationAnglePart
MouseRotationAngle *= 45
工具提示 "Mouse rotation angle: " MouseRotationAngle "°"
SetTimer () => 工具提示(), -1000
返回

ButtonUp:
ButtonDown:
ButtonLeft:
ButtonRight:
ButtonUpLeft:
ButtonUpRight:
ButtonDownLeft:
ButtonDownRight:
if Button != 0
{
    if !InStr(内_此热键, Button)
    {
        MouseCurrentAccelerationSpeed := 0
        MouseCurrentSpeed := MouseSpeed
    }
}
Button := StrReplace(内_此热键, "*")

ButtonAccelerationStart:
if MouseAccelerationSpeed >= 1
{
    if MouseMaxSpeed > MouseCurrentSpeed
    {
        Temp := 0.001
        Temp *= MouseAccelerationSpeed
        MouseCurrentAccelerationSpeed += Temp
        MouseCurrentSpeed += MouseCurrentAccelerationSpeed
    }
}

;MouseRotationAngle convertion to speed of button direction
{
    MouseCurrentSpeedToDirection := MouseRotationAngle
    MouseCurrentSpeedToDirection /= 90.0
    Temp := MouseCurrentSpeedToDirection

    if Temp >= 0
    {
        if Temp < 1
        {
            MouseCurrentSpeedToDirection := 1
            MouseCurrentSpeedToDirection -= Temp
            跳转 EndMouseCurrentSpeedToDirectionCalculation
        }
    }
    if Temp >= 1
    {
        if Temp < 2
        {
            MouseCurrentSpeedToDirection := 0
            Temp -= 1
            MouseCurrentSpeedToDirection -= Temp
            跳转 EndMouseCurrentSpeedToDirectionCalculation
        }
    }
    if Temp >= 2
    {
        if Temp < 3
        {
            MouseCurrentSpeedToDirection := -1
            Temp -= 2
            MouseCurrentSpeedToDirection += Temp
            跳转 EndMouseCurrentSpeedToDirectionCalculation
        }
    }
    if Temp >= 3
    {
        if Temp < 4
        {
            MouseCurrentSpeedToDirection := 0
            Temp -= 3
            MouseCurrentSpeedToDirection += Temp
            跳转 EndMouseCurrentSpeedToDirectionCalculation
        }
    }
}
EndMouseCurrentSpeedToDirectionCalculation:

;MouseRotationAngle convertion to speed of 90 degrees to right
{
    MouseCurrentSpeedToSide := MouseRotationAngle
    MouseCurrentSpeedToSide /= 90.0
    Temp := Mod(MouseCurrentSpeedToSide, 4)

    if Temp >= 0
    {
        if Temp < 1
        {
            MouseCurrentSpeedToSide := 0
            MouseCurrentSpeedToSide += Temp
            跳转 EndMouseCurrentSpeedToSideCalculation
        }
    }
    if Temp >= 1
    {
        if Temp < 2
        {
            MouseCurrentSpeedToSide := 1
            Temp -= 1
            MouseCurrentSpeedToSide -= Temp
            跳转 EndMouseCurrentSpeedToSideCalculation
        }
    }
    if Temp >= 2
    {
        if Temp < 3
        {
            MouseCurrentSpeedToSide := 0
            Temp -= 2
            MouseCurrentSpeedToSide -= Temp
            跳转 EndMouseCurrentSpeedToSideCalculation
        }
    }
    if Temp >= 3
    {
        if Temp < 4
        {
            MouseCurrentSpeedToSide := -1
            Temp -= 3
            MouseCurrentSpeedToSide += Temp
            跳转 EndMouseCurrentSpeedToSideCalculation
        }
    }
}
EndMouseCurrentSpeedToSideCalculation:

MouseCurrentSpeedToDirection *= MouseCurrentSpeed
MouseCurrentSpeedToSide *= MouseCurrentSpeed

Temp := Mod(MouseRotationAnglePart, 2)

if Button = "NumpadUp"
{
    if Temp = 1
    {
        MouseCurrentSpeedToSide *= 2
        MouseCurrentSpeedToDirection *= 2
    }

    MouseCurrentSpeedToDirection *= -1
    鼠标移动 MouseCurrentSpeedToSide, MouseCurrentSpeedToDirection, 0, "R"
}
else if Button = "NumpadDown"
{
    if Temp = 1
    {
        MouseCurrentSpeedToSide *= 2
        MouseCurrentSpeedToDirection *= 2
    }

    MouseCurrentSpeedToSide *= -1
    鼠标移动 MouseCurrentSpeedToSide, MouseCurrentSpeedToDirection, 0, "R"
}
else if Button = "NumpadLeft"
{
    if Temp = 1
    {
        MouseCurrentSpeedToSide *= 2
        MouseCurrentSpeedToDirection *= 2
    }

    MouseCurrentSpeedToSide *= -1
    MouseCurrentSpeedToDirection *= -1

    鼠标移动 MouseCurrentSpeedToDirection, MouseCurrentSpeedToSide, 0, "R"
}
else if Button = "NumpadRight"
{
    if Temp = 1
    {
        MouseCurrentSpeedToSide *= 2
        MouseCurrentSpeedToDirection *= 2
    }

    鼠标移动 MouseCurrentSpeedToDirection, MouseCurrentSpeedToSide, 0, "R"
}
else if Button = "NumpadHome"
{
    Temp := MouseCurrentSpeedToDirection
    Temp -= MouseCurrentSpeedToSide
    Temp *= -1
    Temp2 := MouseCurrentSpeedToDirection
    Temp2 += MouseCurrentSpeedToSide
    Temp2 *= -1
    鼠标移动 Temp, Temp2, 0, "R"
}
else if Button = "NumpadPgUp"
{
    Temp := MouseCurrentSpeedToDirection
    Temp += MouseCurrentSpeedToSide
    Temp2 := MouseCurrentSpeedToDirection
    Temp2 -= MouseCurrentSpeedToSide
    Temp2 *= -1
    鼠标移动 Temp, Temp2, 0, "R"
}
else if Button = "NumpadEnd"
{
    Temp := MouseCurrentSpeedToDirection
    Temp += MouseCurrentSpeedToSide
    Temp *= -1
    Temp2 := MouseCurrentSpeedToDirection
    Temp2 -= MouseCurrentSpeedToSide
    鼠标移动 Temp, Temp2, 0, "R"
}
else if Button = "NumpadPgDn"
{
    Temp := MouseCurrentSpeedToDirection
    Temp -= MouseCurrentSpeedToSide
    Temp2 *= -1
    Temp2 := MouseCurrentSpeedToDirection
    Temp2 += MouseCurrentSpeedToSide
    鼠标移动 Temp, Temp2, 0, "R"
}

SetTimer "ButtonAccelerationEnd", 10
返回

ButtonAccelerationEnd()
{
    global
    if GetKeyState(Button, "P")
    {
        Gosub ButtonAccelerationStart
        返回
    }

    SetTimer, 0
    MouseCurrentAccelerationSpeed := 0
    MouseCurrentSpeed := MouseSpeed
    Button := 0
}

;Mouse wheel movement support

ButtonWheelSpeedUp:
MouseWheelSpeed++
MouseWheelSpeedMultiplier := RegRead("HKCU\Control Panel\Desktop", "WheelScrollLines")
if MouseWheelSpeedMultiplier <= 0
    MouseWheelSpeedMultiplier := 1
MouseWheelSpeedReal := MouseWheelSpeed
MouseWheelSpeedReal *= MouseWheelSpeedMultiplier
工具提示 "Mouse wheel speed: " MouseWheelSpeedReal " lines"
SetTimer () => 工具提示(), -1000
返回
ButtonWheelSpeedDown:
MouseWheelSpeedMultiplier := RegRead("HKCU\Control Panel\Desktop", "WheelScrollLines")
if MouseWheelSpeedMultiplier <= 0
    MouseWheelSpeedMultiplier := 1
if MouseWheelSpeedReal > MouseWheelSpeedMultiplier
{
    MouseWheelSpeed--
    MouseWheelSpeedReal := MouseWheelSpeed
    MouseWheelSpeedReal *= MouseWheelSpeedMultiplier
}
if MouseWheelSpeedReal = 1
    工具提示 "Mouse wheel speed: " MouseWheelSpeedReal " line"
else
    工具提示 "Mouse wheel speed: " MouseWheelSpeedReal " lines"
SetTimer () => 工具提示(), -1000
返回

ButtonWheelAccelerationSpeedUp:
MouseWheelAccelerationSpeed++
MouseWheelSpeedMultiplier := RegRead("HKCU\Control Panel\Desktop", "WheelScrollLines")
if MouseWheelSpeedMultiplier <= 0
    MouseWheelSpeedMultiplier := 1
MouseWheelAccelerationSpeedReal := MouseWheelAccelerationSpeed
MouseWheelAccelerationSpeedReal *= MouseWheelSpeedMultiplier
工具提示 "Mouse wheel acceleration speed: " MouseWheelAccelerationSpeedReal " lines"
SetTimer () => 工具提示(), -1000
返回
ButtonWheelAccelerationSpeedDown:
MouseWheelSpeedMultiplier := RegRead("HKCU\Control Panel\Desktop", "WheelScrollLines")
if MouseWheelSpeedMultiplier <= 0
    MouseWheelSpeedMultiplier := 1
if MouseWheelAccelerationSpeed > 1
{
    MouseWheelAccelerationSpeed--
    MouseWheelAccelerationSpeedReal := MouseWheelAccelerationSpeed
    MouseWheelAccelerationSpeedReal *= MouseWheelSpeedMultiplier
}
if MouseWheelAccelerationSpeedReal = 1
    工具提示 "Mouse wheel acceleration speed: " MouseWheelAccelerationSpeedReal " line"
else
    工具提示 "Mouse wheel acceleration speed: " MouseWheelAccelerationSpeedReal " lines"
SetTimer () => 工具提示(), -1000
返回

ButtonWheelMaxSpeedUp:
MouseWheelMaxSpeed++
MouseWheelSpeedMultiplier := RegRead("HKCU\Control Panel\Desktop", "WheelScrollLines")
if MouseWheelSpeedMultiplier <= 0
    MouseWheelSpeedMultiplier := 1
MouseWheelMaxSpeedReal := MouseWheelMaxSpeed
MouseWheelMaxSpeedReal *= MouseWheelSpeedMultiplier
工具提示 "Mouse wheel maximum speed: " MouseWheelMaxSpeedReal " lines"
SetTimer () => 工具提示(), -1000
返回
ButtonWheelMaxSpeedDown:
MouseWheelSpeedMultiplier := RegRead("HKCU\Control Panel\Desktop", "WheelScrollLines")
if MouseWheelSpeedMultiplier <= 0
    MouseWheelSpeedMultiplier := 1
if MouseWheelMaxSpeed > 1
{
    MouseWheelMaxSpeed--
    MouseWheelMaxSpeedReal := MouseWheelMaxSpeed
    MouseWheelMaxSpeedReal *= MouseWheelSpeedMultiplier
}
if MouseWheelMaxSpeedReal = 1
    工具提示 "Mouse wheel maximum speed: " MouseWheelMaxSpeedReal " line"
else
    工具提示 "Mouse wheel maximum speed: " MouseWheelMaxSpeedReal " lines"
SetTimer () => 工具提示(), -1000
返回

ButtonWheelUp:
ButtonWheelDown:

if Button != 0
{
    if Button != 内_此热键
    {
        MouseWheelCurrentAccelerationSpeed := 0
        MouseWheelCurrentSpeed := MouseWheelSpeed
    }
}
Button := StrReplace(内_此热键, "*")

ButtonWheelAccelerationStart:
if MouseWheelAccelerationSpeed >= 1
{
    if MouseWheelMaxSpeed > MouseWheelCurrentSpeed
    {
        Temp := 0.001
        Temp *= MouseWheelAccelerationSpeed
        MouseWheelCurrentAccelerationSpeed += Temp
        MouseWheelCurrentSpeed += MouseWheelCurrentAccelerationSpeed
    }
}

if Button = "NumpadSub"
    鼠标点击 "WheelUp",,, MouseWheelCurrentSpeed, 0, "D"
else if Button = "NumpadAdd"
    鼠标点击 "WheelDown",,, MouseWheelCurrentSpeed, 0, "D"

SetTimer "ButtonWheelAccelerationEnd", 100
返回

ButtonWheelAccelerationEnd()
{
    global
    if GetKeyState(Button, "P")
    {
        Gosub ButtonWheelAccelerationStart
        返回
    }

    MouseWheelCurrentAccelerationSpeed := 0
    MouseWheelCurrentSpeed := MouseWheelSpeed
    Button := 0
}
